<template>
  <div>
    <crumbs :BreadCrumb="BreadCrumb"></crumbs>
    <div class="main-box">
      <!-- 搜索 -->
      <div class="top_b">
        <!-- <div class="top_inp"> -->
        <el-form :inline="true" :model="searchForm" ref="ruleFormed" label-position="right" :rules="rulesed"
                 style="width: 100%;">
          <div class="gongneng">
            <div>
              <el-form-item label="单位名称" prop="organization">
                <el-input class="input_c" v-model="searchForm.name" clearable></el-input>
              </el-form-item>
              <el-form-item label="负责人电话" prop="phone">
                <el-input class="input_c" v-model="searchForm.directorTel" clearable></el-input>
              </el-form-item>
              <el-form-item label="会员级别" prop="rank">
                <el-select v-model="searchForm.vipLevel" placeholder="请选择">
                  <el-option label="普通" value="普通"></el-option>
                  <el-option label="vip" value="vip"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" icon="el-icon-search" @click="getQueryList()">查询</el-button>
              </el-form-item>
            </div>

            <div class="btn_t">
              <div class="chir_o">
                <el-form-item label="" prop="chineseName">
                  <el-button type="success" @click="addClick()">添加</el-button>
                </el-form-item>
              </div>
            </div>
          </div>
        </el-form>
      </div>
      <!-- 列表 -->
      <div>
        <el-table
            ref="multipleTable"
            :data="enterpriseList"
            tooltip-effect="dark"
            style="width: 100%;margin-top:5px"
            @selection-change="handleSelectionChange"
        >

          <el-table-column
              type="selection"
              width="55">
          </el-table-column>
          <el-table-column sortable prop="orderNo" label="单位编号" width="120">
          </el-table-column>
          <el-table-column
              prop="name"
              label="单位名称"
              width="150">
          </el-table-column>
          <el-table-column
              prop="otherName"
              label="简称"
              width="150">
          </el-table-column>
          <el-table-column
              prop="property"
              label="单位性质"
              width="150">
          </el-table-column>
          <el-table-column
              prop="domain"
              label="单位行业"
              width="150">
          </el-table-column>
          <el-table-column
              prop="linker"
              label="联系人"
              width="150">
          </el-table-column>
          <el-table-column
              prop="linkTel"
              label="联系电话"
              width="150">
          </el-table-column>
          <el-table-column
              prop="personCharge"
              label="负责人"
              width="150">
          </el-table-column>
          <el-table-column
              prop="personChargePhone"
              label="负责人电话"
              width="150">
          </el-table-column>
          <el-table-column
              prop="email"
              label="联系邮箱"
              width="150">
          </el-table-column>
          <el-table-column
              prop="vipLevel"
              label="会员级别"
              width="150">
          </el-table-column>
          <el-table-column
              prop="address"
              label="单位地址"
              width="150">
          </el-table-column>
          <el-table-column
              prop="currentAddress"
              label="现居地址"
              width="150">
          </el-table-column>
          <el-table-column
              prop="status"
              label="单位状态"
              width="150">
          </el-table-column>
          <el-table-column
              label="注册时间"
              width="150">
            <template slot-scope="scope">
              {{ formatTimes(scope.row.editTime) }}
            </template>
          </el-table-column>
          <el-table-column width="260" prop="address" label="操作" fixed="right">
            <template slot-scope="scope">
              <el-button @click="getLogs(scope.row)" style="background:#4DD2D2; color:#ffffff" size="small">体检史
              </el-button>
              <el-button type="primary" @click="handleClick(scope.row)" size="small">编辑
              </el-button>
              <el-button type="danger" @click="remove(scope.row)" size="small">删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 分页 -->
      <div class="pagination">
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="pageNo"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total">
        </el-pagination>
      </div>
    </div>

    <!-- 编辑 -->
    <el-dialog :title="title" :visible.sync="dialogFormVisible" width="70%" class="top_dialog">
      <div class="add_info">
        <unitinfo ref="riskForm" :dictdata="dict" :queryform="queryform"></unitinfo>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="addEditInfo()">保存</el-button>
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 体检史 -->
    <el-dialog
        title="历史体检记录"
        :visible.sync="medicalHistoryed"
        width="70%"
        class="top_dialog"
        :before-close="medicalClose">
      <div class="tab_box">
        <div class="box_th">
          <!-- 合同列表 -->
          <div>
            <el-table
                ref="multipleTable"
                :data="contractList"
                tooltip-effect="dark"
                style="width: 100%;margin-top:5px"
            >
              <el-table-column type="selection" width="100"></el-table-column>
              <el-table-column
                  prop="cnum"
                  label="合同编号"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="cname"
                  label="合同名称"
              >
              </el-table-column>
              <el-table-column
                  prop="orderDate"
                  label="签订日期"
                  width="160">
                <template slot-scope="scope">
                  {{ scope.row.orderDate|formatDate }}
                </template>
              </el-table-column>
              <el-table-column
                  prop="endDate"
                  label="有效到期"
                  width="160">
                <template slot-scope="scope">
                  {{ scope.row.endDate|formatDate }}
                </template>
              </el-table-column>
              <el-table-column
                  prop="numberInspectors"
                  label="检查人数"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="personName"
                  label="销售人员"
                  width="160">
              </el-table-column>
            </el-table>
          </div>
        </div>

        <!-- 合同参检人员名单列表 -->
        <div class="box_th">
          <el-form :inline="true" :model="form" ref="ruleForm" :rules="rules">
            <div class="rule_box">
              <div class="t_head">合同参检人员名单</div>
              <el-form-item label="姓名/手机号" prop="Phones" :label-width="labelwidth">
                <el-input v-model="form.roleName" autocomplete="off"></el-input>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" @click="dialogFormVisible = false">搜索</el-button>
              </el-form-item>
            </div>
          </el-form>
          <div>
            <el-table
                ref="multipleTable"
                :data="physicalList"
                tooltip-effect="dark"
                style="width: 100%;margin-top:5px"
            >
              <el-table-column
                  type="selection"
                  width="100">
              </el-table-column>
              <el-table-column
                  prop="orderNo"
                  label="体检单号"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="customerName"
                  label="姓名"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="sex"
                  label="性别"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="age"
                  label="年龄"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="company"
                  label="单位"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="packageCustomname"
                  label="体检套餐"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="status"
                  label="体检状态"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="signDatetime"
                  label="体检时间"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="printTime"
                  label="打印报告时间"
                  width="160">
              </el-table-column>
              <el-table-column
                  prop="duration"
                  label="操作"
                  fixed="right"
                  width="160">
                <template slot-scope="scope">
                  <el-button @click="personLogs(scope.row)" size="small">体检史</el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <!--          <el-pagination-->
          <!--              @size-change="handleSizeChange"-->
          <!--              @current-change="handleCurrentChange"-->
          <!--              :current-page="searchForm.pageNo"-->
          <!--              :page-sizes="[10, 20, 30, 40]"-->
          <!--              :page-size="searchForm.pageSize"-->
          <!--              layout="total, sizes, prev, pager, next, jumper"-->
          <!--              :total="400"-->
          <!--              style="margin-top:10px;">-->
          <!--          </el-pagination>-->
        </div>
        <div style="text-align: right;">
          <el-button @click="medicalHistoryed = false">关 闭</el-button>
        </div>
      </div>
    </el-dialog>
    <!-- 编辑合同-->
    <el-dialog
        title="编辑合同"
        :visible.sync="editcontractdialog"
        width="50%"
        class="top_dialog"
    >
      <el-form :model="form" :rules="rules" ref="ruleForm" label-position="left">
        <div class="list">
          <el-form-item>
            <el-button class="newunit" type="primary" @click="dialogFormVisible2=true">新建单位</el-button>
          </el-form-item>
          <el-form-item label="单位名称" :label-width="formLabelWidth">
            <el-input v-model="enterpriseName" style="width: 200px;margin-right: 10px;"></el-input>
            <el-button @click="readEnterpriseList">选择</el-button>
          </el-form-item>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="合同编号" :label-width="formLabelWidth">
                <el-input v-model="form.cnum"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="合同名称" :label-width="formLabelWidth">
                <el-input v-model="form.cname"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <div class="info_sel">
            <div class="info_sel_l">
              <el-form-item label="签订日期" :label-width="formLabelWidth">
                <el-date-picker
                    v-model="form.orderDate"
                    type="date"
                    placeholder="选择日期"
                    value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="生效日期" :label-width="formLabelWidth">
                <el-date-picker
                    v-model="form.effectiveDate"
                    type="date"
                    placeholder="选择日期"
                    value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="付款方式" :label-width="formLabelWidth">
                <el-select v-model="formInline.payMode">
                  <el-option label="银行转账" value="1"></el-option>
                  <el-option label="支票" value="2"></el-option>
                  <el-option label="支付宝" value="3"></el-option>
                  <el-option label="银行卡" value="4"></el-option>
                  <el-option label="其他" value="5"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="折扣率" :label-width="formLabelWidth">
                <el-input v-model="form.discount"></el-input>
              </el-form-item>
            </div>
            <div class="info_sel_r">
              <el-form-item label="有效日期" :label-width="formLabelWidth">
                <el-date-picker
                    v-model="form.endDate"
                    type="date"
                    placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="签订人" :label-width="formLabelWidth">
                <el-input v-model="form.linker"></el-input>
              </el-form-item>
              <el-form-item label="体验类型" :label-width="formLabelWidth">
                <el-input v-model="form.medicalType"></el-input>
              </el-form-item>
              <el-form-item label="销售人员" :label-width="formLabelWidth">
                <el-input v-model="form.personId"></el-input>
              </el-form-item>
            </div>
          </div>
          <el-form-item label="备注" :label-width="formLabelWidth">
            <el-input type="textarea" v-model="form.remark"></el-input>
          </el-form-item>
          <el-form-item label="备注" :label-width="formLabelWidth">
            <el-radio-group v-model="form.status">
              <el-radio label="1">立即生效</el-radio>
              <el-radio label="2">无效</el-radio>
              <el-radio label="3">封口</el-radio>
              <el-radio label="4">作废</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item style="text-align: right;">
            <el-button type="success" @click="addContractinfo('ruleForm')">保 存</el-button>
            <el-button @click="dialogFormVisible = false">取 消</el-button>
          </el-form-item>
        </div>
      </el-form>
    </el-dialog>
    <!-- 新建单位 -->
    <el-dialog
        title="单位编辑"
        :visible.sync="dialogFormVisible2"
        width="60%"
        class="top_dialog"
    >
      <div>
        <el-row>
          <el-col :span="24">
            <div class="info_l_head">
              <div>新建单位信息</div>
              <el-divider></el-divider>
              <div>
                <el-form ref="form" :rules="rules1" :model="formlist" label-width="80px">
                  <el-form-item :label-width="formLabelWidth" label="单位名称">
                    <el-input v-model="formlist.name"></el-input>
                  </el-form-item>
                  <el-form-item :label-width="formLabelWidth" label="简称">
                    <el-input v-model="formlist.otherName"></el-input>
                  </el-form-item>
                  <div class="dwflex">
                    <div>
                      <el-form-item :label-width="formLabelWidth" label="单位性质">
                        <el-select v-model="formlist.property">
                          <el-option label="区域一" value="区域一"></el-option>
                          <el-option label="区域二" value="区域二"></el-option>
                        </el-select>
                      </el-form-item>
                      <el-form-item :label-width="formLabelWidth" label="联系人">
                        <el-input v-model="formlist.linker"></el-input>
                      </el-form-item>
                      <el-form-item :label-width="formLabelWidth" label="负责人">
                        <el-input v-model="formlist.linker"></el-input>
                      </el-form-item>
                      <el-form-item :label-width="formLabelWidth" label="联系邮箱">
                        <el-input v-model="formlist.email"></el-input>
                      </el-form-item>
                    </div>
                    <div>
                      <el-form-item :label-width="formLabelWidth" label="行业类型">
                        <el-input v-model="formlist.domain"></el-input>
                      </el-form-item>
                      <el-form-item :label-width="formLabelWidth" label="联系方式">
                        <el-input v-model="formlist.linkTel"></el-input>
                      </el-form-item>
                      <el-form-item :label-width="formLabelWidth" label="负责人电话">
                        <el-input v-model="formlist.linkTel"></el-input>
                      </el-form-item>
                      <el-form-item :label-width="formLabelWidth" label="会员级别">
                        <el-select v-model="formlist.mangeGrade">
                          <el-option label="主管" value="主管"></el-option>
                          <el-option label="员工" value="员工"></el-option>
                        </el-select>
                      </el-form-item>
                    </div>
                  </div>
                  <el-form-item :label-width="formLabelWidth" label="单位地址">
                    <el-input type="textarea" v-model="formlist.address"></el-input>
                  </el-form-item>
                  <el-form-item :label-width="formLabelWidth" label="启用">
                    <el-switch v-model="formlist.isuse"></el-switch>
                  </el-form-item>
                </el-form>
              </div>
            </div>
          </el-col>
        </el-row>
      </div>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="addCompany('form')">保 存</el-button>
        <el-button @click="dialogFormVisible2 = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 单位名称选择 -->
    <el-dialog
        title="选择单位"
        :visible.sync="dialogFormVisible3"
        width="60%"
        class="top_dialog"
    >
      <div>
        <el-row>
          <el-col :span="24">
            <div class="ifunit">
              <el-input v-model="roleName" placeholder="请输入查询关键词"></el-input>
              <el-button @click="querycompany()">查找</el-button>
            </div>
            <div>
              <el-table
                  ref="multipleTable1"
                  :data="tableData3"
                  tooltip-effect="dark"
                  width="100%"
                  @select="selectrow">
                <el-table-column
                    type="selection"
                    width="55">
                </el-table-column>
                <el-table-column
                    prop="name"
                    label="单位名称"
                    width="120">
                </el-table-column>
                <el-table-column
                    prop="linker"
                    label="联系人"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    prop="linkTel"
                    label="联系人电话"
                    show-overflow-tooltip>
                </el-table-column>
                <el-table-column
                    prop="mangeGrade"
                    label="会员级别"
                    show-overflow-tooltip>
                </el-table-column>
              </el-table>
            </div>
          </el-col>
        </el-row>
      </div>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="choiceCompanyid()">保 存</el-button>
        <el-button @click="dialogFormVisible3 = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 修改合同end -->
  </div>
</template>

<script>
import crumbs from "../../views/Crumbs.vue";
import unitinfo from "../common/unitinfo.vue";
import {formatTimeToStr} from "@src/common/utils/date";

export default {
  components: {
    crumbs,
    unitinfo,
  },
  data() {
    return {
      editcontractdialog: false,
      enterpriseList: [],
      enterpriseTotal: 0,
      labelwidth: '100px',
      formLabelWidth: '80px',
      remodeMes: false,
      searchForm: {},
      field125Options: [{
        "label": "立即生效",
        "value": 1
      }],
      editForm: {},
      rulesed: {},
      rules: {
        roleName: [
          {required: true, message: '请输入角色名称', trigger: 'blur'}
        ],
        remarks: [
          {required: true, message: '请输入备注', trigger: 'blur'}
        ],
      },

      dialogFormVisible: false,
      BreadCrumb: [
        {path: "", name: "检前管理"},
        {path: "", name: "单位档案"},
      ],
      clearable: false,
      roleName: '',
      list: [],
      contractList: [],
      physicalList: [],

      checkedCities: [],
      checkedCitiess: [],
      cities: [],
      citiess: [],
      record: false,
      medicalHistoryed: false,
      options: [
        {
          value: '选项1',
          label: '有效'
        }, {
          value: '选项2',
          label: '无效'
        },
        {
          value: '选项3',
          label: '异常'
        }
      ],
      value: '',
      form: {},
      formInline: {},
      groupform: {},
      tableData: [],
      checkPerson: {},
      formlist: {},
      dialogFormVisible3: false,
      dialogFormVisible2: false,
      tableData2: [],
      // 单位列表
      tableData3: [],
      enterpriseId: "",
      enterpriseName: "",
      selectinfo: {},
      contractid: "",

      // 验证新建单位
      rules1: {
        // hospitalCode:[{ required: true, message: '请输入医院代码', trigger: 'blur' }],
      },
      // 新建合同返回的信息
      callbackdata: {},
      checkpersonid: "",
      // 页码
      pageSize: 10,
      pageNo: 1,
      total: 0,
      id: null,
      title: "",
      queryform: {},
      checkform: {},
      multipleTable: [],
      medicalhistory: {},
      fileList: [],
      activeName: 'first',
      dict: {},
    }
  },
  filters: {
    formatDate: function (time) {
      if (time != null && time !== "") {
        var date = new Date(time);
        return formatTimeToStr(date, "yyyy-MM-dd hh:mm");
      } else {
        return "";
      }
    },
    formatCustomerStatus: function (val) {
      var dict = {1: "正常", 2: "无效", 3: "限制", 4: "拉黑", 5: "死亡"}
      return dict[val]
    },
    formatSex: function (val) {
      var dict = {1: "男", 2: "女"}
      return dict[val]
    },
    formatCredNum: function (val) {
      if (val !== null) {
        return val.replace(/^(.{6})(?:\d+)(.{4})$/, "\$1****\$2")
      }
      return val
    },
  },
  created() {
    this.getQueryList()
    this.searchDictList()
  },
  methods: {
    personLogs(row){

      this.$axios.getPeCustomerLogs({peCustomersId:row.id}).then((res) => {
        if (res.code === "00000") {
          res.data.forEach(v => {
            this.dict[v.dictCode] = v.items
          })
        }
      });
    },
    searchDictList() {
      this.$axios.searchDictList({
        codes: ["tyType", "xmType", "jgType", "mzType", "gwType", "zwType", "ybType", "dwxzType", 'zylbType', 'zjType','domain'],
      }).then((res) => {
        if (res.code === "00000") {
          res.data.forEach(v => {
            this.dict[v.dictCode] = v.items
          })
        }
      });
    },
    // 获取体检史列表
    getLogs(row) {
      this.medicalhistory = row;
      // todo 获取体检历史
      this.$axios
          .getEnterpriseContracts({
            peEnterprisesId: row.id,
          }).then(res => {
        if (res.code === '00000') {
          this.contractList = res.data.peEnterpriseContracts
          this.physicalList = res.data.peOrdersMain.records
          this.dialogFormVisible = false
        }
      })
      this.medicalHistoryed = true
    },

    // 点击新增信息按钮触发弹窗
    addClick() {
      // this.queryform = {};
      // console.log(this.checkform);
      this.id = null;
      this.title = "添加信息";
      if (this.id == null) {
        this.queryform = {};
      }
      this.dialogFormVisible = true;
    },

    // 点击保存
    addEditInfo(formName) {
      // 在这里验证
      this.$refs.riskForm.$refs.riskFormRef.validate((valid) => {
        if (valid) {
          // 获取子组件form
          this.checkform = this.$refs.riskForm.$refs.riskFormRef.model;
          // console.log("子组件表单信息：",this.checkform)

          if (this.id == null) {
            this.$axios
                .addEnterprise({
                  ...this.checkform,
                })
                .then((res) => {
                  if (res.code == "00000") {
                    this.$message({
                      type: "success",
                      message: res.msg,
                    });
                    this.dialogFormVisible = false;
                    this.getQueryList();
                  }
                  // console.log(res);
                });
          } else {
            this.$axios
                .updateEnterprise({
                  // peCustomersId: this.id,
                  ...this.checkform
                })
                .then((res) => {
                  if (res.code == "00000") {
                    this.$message({
                      type: "success",
                      message: res.msg,
                    });
                    this.dialogFormVisible = false;
                    this.getQueryList();
                  }
                  // console.log(res);
                });
          }
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // 编辑
    handleClick(row) {
      // console.log(row.id);
      this.$axios
          .getEnterpriseById({
            id: row.id,
          })
          .then((res) => {
            if (res.code == "00000") {
              this.id = row.id;
              this.queryform = res.data;
              this.title = "编辑信息";
              this.dialogFormVisible = true;
            }
            // console.log(res.data,this.queryform)
          });
    },
    handleSelectionChange(val) {
      this.multipleTable = val;
      // console.log(this.multipleTable);
    },
    // 列表删除
    remove(row) {
      const idstring = row.id;
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delEnterprise({
          "peEnterprisesIds": idstring,
        }).then(res => {
          if (res.code == '00000') {
            this.$message({
              type: 'success',
              message: '删除成功!'
            });
            this.getQueryList()
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    removeAll() {
      // console.log(this.multipleTable);
      // let len = this.multipleTable.length;
      let idstring = [];
      this.multipleTable.forEach(item => {
        idstring.push(item.id);
      })
      idstring = idstring.join(",");
      console.log(typeof (idstring), idstring);
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delEnterprise({
          "peEnterprisesIds": idstring,
        }).then(res => {
          console.log(res)
          if (res.code == '00000') {
            this.$message({
              type: 'success',
              message: '删除成功!'
            });
            this.getQueryList()
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // 查找条件
    querybyid() {
      console.log(this.searchForm)
      this.$axios
          .queryPbPersonsList({
            ...this.searchForm
          }).then(res => {
        if (res.code == '00000') {
          this.enterpriseList = res.data.records
          this.total = res.data.total
        }
      })
    },
    // 所有信息查询
    getQueryList() {
      this.doGetList(this.searchForm)
    },
    doGetList(req) {
      this.$axios.getEnterpriseList(req).then(res => {
        if (res.code == '00000') {
          this.enterpriseList = res.data.records
          this.total = res.data.total
        }
        // console.log(res);
      })
    },
    // 每页几条
    handleSizeChange(val) {
      this.pageSize = val
      const req = {
        ...this.searchForm,
        pageSize: this.pageSize,
        pageNo: this.pageNo,
      }
      this.doGetList(req)
    },
    // 第几页
    handleCurrentChange(val) {
      this.pageNo = val
      const req = {
        ...this.searchForm,
        pageSize: this.pageSize,
        pageNo: this.pageNo,
      }
      this.doGetList(req)
    },
    // 新建单位信息
    addCompany(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.$axios.addEnterprise({
            name: this.formlist.name,
            otherName: this.formlist.otherName,
            property: this.formlist.property,
            domain: this.formlist.domain,
            linker: this.formlist.linker,
            linkTel: this.formlist.linkTel,
            email: this.formlist.email,
            mangeGrade: this.formlist.mangeGrade,
            address: this.formlist.address
          }).then(res => {
            console.log(this.formlist);
            if (res.code == '00000') {
              this.$message({
                type: 'success',
                message: res.msg
              })
              this.dialogFormVisible2 = false;
            }
            // console.log(res)
          })
        }
      })
    },
    // 单选
    selectrow(selection, row) {
      this.selectinfo = row;
      // console.log("选中的信息: ",this.selectinfo);
      if (selection.length > 1) {
        let del_row = selection.shift()
        this.$refs.multipleTable1.toggleRowSelection(del_row, false) // 用于多选表格，切换某一行的选中状态，如果使用了第二个参数，则是设置这一行选中与否（selected 为 true 则选中）
      }
    },
    // 单位列表保存
    choiceCompanyid() {
      this.enterpriseId = this.selectinfo.id;
      this.enterpriseName = this.selectinfo.name;
      this.dialogFormVisible3 = false;
      this.roleName = "";
      // console.log(this.enterpriseId,this.enterpriseName);
    },
    // 搜索单位名称
    querycompany() {
      this.$axios.getEnterpriseList({
        name: this.roleName
      }).then(res => {
        if (res.code == '00000') {
          this.tableData3 = res.data.records
          // this.total = res.data.total
          // console.log("查询到的单位列表",res.data);
        }
      })
    },
    // 单位查询
    readEnterpriseList() {
      this.dialogFormVisible3 = true;
      this.title = "选择单位";
      this.$axios.getEnterpriseList({}).then(res => {
        if (res.code == '00000') {
          this.tableData3 = res.data.records
          // this.total = res.data.total
          // console.log("单位列表",res.data);
        }
      })
    },

    // 编辑合同
    addContractinfo(row) {
      this.$axios.updatePeEnterpriseContracts({
        ...row
      }).then(res => {
        if (res.code == '00000') {
          this.$message({
            type: 'success',
            message: res.msg
          })
        }
        console.log(res)
      })
    },

    medicalClose() {
      this.medicalHistoryed = false
    },
  }
}
</script>

<style scoped>
.top_but {
  margin-left: 20px;
}

.top_buts {
  margin-top: 10px;
  margin-bottom: 10px;
}

.pagination {
  text-align: center;
}

.top_b {
  display: flex;
}

.top_inp {
  /* width: 300px; */
  display: flex;
}

/*  */

.el-select {
  width: 300px;
}

.date {
  text-align: right;
  color: #7F7F7F;
  font-weight: bold;
}

.info_l {
  /* width: 80%; */
  margin: 0px auto;
}

/* .info_l_input {
  width: 82%;
} */
.info_l_button {
  margin-left: 10px;
}

.info_sel_r_groupn {
  margin-left: 40px;
}

.info_sel_r_group {
  margin-left: 10px;
}

.info_sel {
  display: flex;
}

.info_sel_l {
  width: 50%;
}

.info_sel_r {
  width: 50%;
  margin-left: 50px;
}

.numb_er {
  font-weight: bold;
}

.info_sel_r_img {
  width: 180px;
  height: 220px;
  margin: 0px auto;
}

.avatar-uploader {
  margin: 0px auto;
  text-align: center;
}

.info_l /deep/ .el-select {
  width: 100%;
}

.info_l_head {

}

.text_a {
  width: 50%;
}

.t_head {
  line-height: 39px;
  margin-right: 50px;
}

.el-table th > .cell {
  white-space: nowrap;
}

.add_info {
  display: flex;
}

.message {
  line-height: 50px;
  border-bottom: 1px solid #cccccc;
  margin-bottom: 10px;
}

.subtion {
  display: flex;
  justify-content: space-between;
}

.info_r {
  margin-left: 20px;
}

.tan_t {
  border-bottom: 1px solid #cccccc;
}

.tab_b {
  display: flex;
  justify-content: space-between;
  line-height: 50px;
  border-bottom: 1px solid #ccc;
}

.tab_c {
  display: flex;
}

.gongneng {
  display: flex;
  justify-content: space-between;
}

.btn_t {
  display: flex;
  justify-content: space-between;
}

.chir_o {
  width: 260px;
}

.tan_k {
  display: flex;
  justify-content: space-between;
}

.textarea {
  width: 350px;
  height: 120px;
}

.el-textarea /deep/ .el-textarea__inner {
  min-height: 89px;
  height: 89px;
}

.text_a > span {
  width: 100%;
  display: inline-block;
  border-bottom: 1px solid #cccccc;
}

.add_jian {
  padding-top: 15px;

}

.add_jian > span {
  display: block;
  color: #3298D3;
  font-size: 8px;
  line-height: 24px;
}

::v-deep .el-dialog {
  width: 65%;
}

::v-deep .el-dialog__body {
  border: 0px;
}

.dia_box {
  display: flex;
}

.rule_box {
  display: flex;
  margin-top: 20px;
}

.top_dialog /deep/ .el-dialog {
  margin-top: 3vh !important;
}
</style>


